﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;

namespace DSS_Simplex
{
    public partial class SaveAs : Form
    {
        MySqlConnection connection;
        string ConnectionString = "Server=localhost;Database=dss;Uid=root;Pwd=;";
            
        public SaveAs()
        {
            InitializeComponent();
        }

        public void button1_Click(object sender, EventArgs e)
        {
            try
            {
                connection = new MySqlConnection(ConnectionString);
                //sql command object
                string cmdText = "insert into project (nama_proj) VALUES (?nama_proj)";

                MySqlCommand cmd = new MySqlCommand(cmdText, connection);
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.Add("?nama_proj", MySqlDbType.VarChar, 200).Value = textBox1.Text;
                connection.Open();
                int result = cmd.ExecuteNonQuery();
                MessageBox.Show("sukses!");
            }
            catch (Exception ex) 
            {
                MessageBox.Show(ex.Message);
            }
        }
        
    }
}
